/**Transcore is a remote-GUI to Transmission.
Copyright (C) 2009 by Jerry de Swart

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

package transcore;

/**
 *
 * @author J de Swart (Custombuild@gmail.com)
 */
public class TransJSON {
	//Globals
	public static final String METHOD = "method";
	public static final String ARGS = "arguments";
	public static final String TAG = "tag";

	//Methods
	public static final String SESS_STATS = "session-stats";
	public static final String SESS_GET = "session-get";
	public static final String SESS_SET = "session-set";

	public static final String TORR_ADD = "torrent-add";
	public static final String TORR_REMOVE = "torrent-remove";

	public static final String TORR_START = "torrent-start";
	public static final String TORR_STOP = "torrent-stop";
	public static final String TORR_VERIF = "torrent-verify";
	public static final String TORR_GET = "torrent-get";
	public static final String TORR_SET = "torrent-set";

    //Session-get and Session-set
    public static final String ENCRYPT = "encryption";
    public static final String DOWN_DIR = "download-dir";
    public static final String DOWN_LIMIT = "speed-limit-down";
    public static final String UP_LIMIT = "speed-limit-up";
    public static final String PEER_LIMIT = "peer-limit";
    public static final String PORT = "port";
    public static final String USE_DOWN_LIMIT = "speed-limit-down-enabled";
    public static final String USE_UP_LIMIT = "speed-limit-up-enabled";
    public static final String PEX_ALLOWED = "pex-allowed";
    public static final String USE_PORT_FORW = "port-forwarding-enabled";
    public static final String VERSION = "version";

	//Session-stats responses
	public static final String TOTAL_TORR = "torrentCount";
	public static final String ACTIVE_TORR = "activeTorrentCount";
	public static final String PAUSED_TORR = "pausedTorrentCount";
	public static final String TOTAL_DOWNSPEED = "downloadSpeed";
	public static final String TOTAL_UPSPEED = "uploadSpeed";
	public static final String CUMUL_STATS = "cumulative-stats";
	public static final String CURRENT_STATS = "current-stats";
	public static final String UPL_BYTES = "uploadedBytes";
	public static final String DOWNL_BYTES = "downloadedBytes";
	public static final String FILES_ADDED = "filesAdded";
	public static final String SESS_COUNT = "sessionCount";
	public static final String SEC_ACTIVE = "secondsActive";

	/**
	 * Converts an integer to a boolean: 0 returns false, the rest returns 1.
	 *
	 */
	public static Boolean toBool(int i) {
		return (i != 0);
	}

	/**
	 * Converts a boolean to an integer: 0 for false and 1 for true.
	 *
	 */
	public static int toInt(Boolean i){
		if(i){
			return 1;
		}
		return 0;
	}

}
